The reason its not going to work is that $stats is a variable for
$stats['total_topics'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_topics', array( 'approved = ?', 1 ) )->first();
Meaning the \IPS+DB::i means with IPS Database INSERT (i()) and SELECT "count everything" from forums_topic show it as an array first
So your just saying $stats it doesn't know what your reffering too.
The last line i posted is the way that $stats will work as it does the query.