5. If $x \in\left[\frac{1}{27}, 9\right]$, then $f(x)=\log _{3} \frac{x}{27} \cdot \log _{3}(3 x)(\quad)$.
A. has a minimum value of $-\frac{32}{9}$, and a maximum value of -3
B. has a minimum value of -4, and a maximum value of 12
C. has a minimum value of $-\frac{32}{9}$, and no maximum value
D. has no minimum value, and a maximum value of 12
5. B.
$$
f(x)=\left(\log _{3} x-3\right)\left(1+\log _{3} x\right)=\log _{3}^{2} x-2 \log _{3} x-3=\left(\log _{3} x-1\right)^{2}-4 \text {, given } x \in\left[\frac{1}{27}, 9\right] \text {, }
$$

then we get $\log _{3} x \in[-3,2]$, thus $f_{\text {max }}=12, f_{\text {min }}=-4$.