Okay, got the reason for it debugged now..
As my error message says, it is line 177 in modules/stats/mod.stats.php. This code block is in a conditional that checks for:
if (count($this->EE->stats->statdata('current_names')) > 0)
The problem is the use of count() and how EE_Stats::statdata returns an empty response:
libraries/Stats.php
/**
* Get Statdata
*
* This method will retrieve items or the entire statdata class property.
*
* @param string which piece of the array to get (optional)
* @return mixed FALSE on failure, string or array on success
*/
Note that it returns FALSE on failure, which we will get in this case since we don’t have the member module(?). However, count(FALSE) will return TRUE:
http://php.net/manual/en/function.count.php
Which is why the code at line 177 in modules/stats/mod.stats.php is executed at all, when it shouldn’t, thus giving FALSE to the foreach causing the original error I posted.