12. Given $F_{1}$ and $F_{2}$ are the left and right foci of the hyperbola $\frac{x^{2}}{a^{2}}-\frac{y^{2}}{b^{2}}=1$, and $P$ is any point on the left branch of the hyperbola. If $\frac{\left|P F_{2}\right|^{2}}{\left|P F_{1}\right|}$ is $8 a$, then the range of the eccentricity $e$ of the hyperbola is ( ).
(A) $(1,+\infty)$
(B) $(0,3]$
(C) $(1,3]$
(D) $(1,2]$
12.C.

According to the definition of a hyperbola, we have
$$
\begin{array}{l}
\left|P F_{2}\right|-\left|P F_{1}\right|=2 a, \\
\frac{\left|P F_{2}\right|^{2}}{\left|P F_{1}\right|}=\frac{\left(\left|P F_{1}\right|+2 a\right)^{2}}{\left|P F_{1}\right|}=\left|P F_{1}\right|+4 a+\frac{4 a^{2}}{\left|P F_{1}\right|} \\
\geqslant 2 \sqrt{\left|P F_{1}\right| \cdot \frac{4 a^{2}}{\left|P F_{1}\right|}}+4 a=8 a .
\end{array}
$$

Equality holds if and only if $\left|P F_{1}\right|=\frac{4 a^{2}}{\left|P F_{1}\right|}$, i.e., $\left|P F_{1}\right|=2 a$.

Let point $P(x, y)(-x \geqslant a)$, by the second definition of the hyperbola, we get $\left|P F_{1}\right|=-e x-a \geqslant c-a$, i.e., $2 a \geqslant c-a$.
Thus, $e=\frac{c}{a} \leqslant 3$. Since $e>1$, we have $1<e \leqslant 3$.