5. Given the function $f(x)$
$=\log _{a}\left(a x^{2}-x+\frac{1}{2}\right)$ is always positive on the interval $[1,2]$, then the range of the real number $a$ is $\qquad$
When $a>1$, $a x^{2}-x+\frac{1}{2}>1 \Rightarrow a>\frac{1}{2 x^{2}}+\frac{1}{x} \Rightarrow a>\frac{3}{2}$; when $0<a<1$, $0<a x^{2}-x+\frac{1}{2}<1 \Rightarrow-\frac{1}{2 x^{2}}+\frac{1}{x}<a<\frac{1}{2 x^{2}}+\frac{1}{x} \Rightarrow \frac{1}{2}<a<\frac{5}{8}$. Therefore, the range of real number $a$ is $\left(\frac{1}{2}, \frac{5}{8}\right) \cup\left(\frac{3}{2},+\infty\right)$.