Let $f$ be a cuspidal Hecke newform of weight $k$ and level $N$, and denote by $a_f(n)$ its $n$-th Fourier coefficient. The newform $f$ is normalized so that $a_f(1) = 1$. As a consequence of Rankin-Selberg theory, we have that
$$
\sum_{p \leq x} \frac{a_f(p)^2}{p} = \log \log x + B + O(1/\log x), 
$$
for any large $x$, where $B$ is a constant. What do we know about the dependence of $B$ and the implicit constant in the level aspect? Are they bounded in the level aspect, or at least not growing faster than $\log \log N$? (I would like to apply it with $x$ of size about $N$)

To state an analogue result, we can prove that for a compactly supported function $\phi$ we have
$$
\sum_{\substack{p \leq N}} \frac{a_f(p)^2}{p} \frac{\log(p)^2}{\log(N)^2} \phi\left( \frac{\log p}{\log N}\right) =  B_\phi + O\left( \frac{\log\log N}{\log N}\right)
$$
where $B_\phi$ only depends on $\phi$ but not on $f$, and the implicit constant in the error term is absolute. Is there a similar statement for the first sum above? Or a proper way to deduce the first equation from the second statement?