I am trying to bound the sum $$\sum_{n=1, n \neq x}^{\infty} |a_n|(\frac{x}{n})^c \min (1, \frac{1}{R|\log \frac{x}{n}|}) $$
where $c>1$ and $a_n = \mathcal{O}(n^{\epsilon})$, $\epsilon \geq 0$.
I have decided to divide the sum into three parts: $n < x/2, x/2 <n<2x$ and $n > 2x$. For the sum over the first and last range, I can derive the estimate of size $x^{c+\epsilon}$ and $x^{1+\epsilon}$ since logarithm has a lower bound, i.e., $\log \frac{x}{n} \geq \log2$. But for the sum over the middle part (i.e., $x/2 \leq n \leq 2x$), I am not sure how to estimate its bound and apparently this bound seems to be $\frac{x^c}{R} \log x$ according to the book Problems in Analytic Number Theory. How can I derive this bound for the middle part?
When $x/2\le n\le2x$, we have $x/n\le2$, so
\begin{aligned} S &\ll\sum_{\substack{x/2\le n\le x/2\\n\ne x}}|a_n|\min\left(1,{1\over R|\log x/n|}\right) \\ &\ll x^\varepsilon\sum_{\substack{x/2\le n\le x/2\\n\ne x}}\underbrace{\min\left(1,{1\over R|\log x/n|}\right)}_{b_n} \end{aligned}
When $x/2\le n<x$, we have
$$ \left|\log\frac xn\right|=\log\left(1+{x-n\over n}\right)\ge{x-n\over n}\gg{x-n\over x}, $$
and when $x\le n\le 2x$, we have
$$ \left|\log\frac xn\right|=\log\left(1+{n-x\over x}\right)\ge{n-x\over x}. $$
Combining these facts, we see that
$$ b_n\ll\min\left(1,{1\over R|x-n|}\right) $$
Consequently, $S$ becomes
\begin{aligned} S &\ll{x^\varepsilon\over R}\left(\sum_{x/2\le n<x}{1\over x-n}+\sum_{x<n\le x/2}{1\over n-x}\right) \\ &\ll{x^\varepsilon\over R}\left(\sum_{x/2\le n\le x-1}{1\over x-n}+\frac1\delta+\sum_{x+1\le n\le x/2}{1\over n-x}\right) \\ &\ll{x^\varepsilon\over R}\left(\frac1\delta+\int_{x/2}^{x-1}{\mathrm dt\over x-t}+\int_{x+1}^{2x}{\mathrm dt\over t-x}\right) \\ &\ll{x^\varepsilon\log x\over R}+{x^\varepsilon\over R\delta}, \end{aligned}
where $\delta$ is the distance from $x$ to its nearest integer.