Fix #1654

Avoid unviewable most popular forum caching by checking them inside the
function instead of relying on a global variable available only in
stats.php (while the function is used in several places).

https://github.com/mybb/mybb/issues/1654
Doesn't that depend on the permissions of the **current** user?