I noticed in AWStats, someone came to our website looking for "mod_serverstat.php division by zero fix". This error was being displayed briefly (and unfortunately at the time particular pages were being first indexed) and was being caused by a Joomla! module that we had installed by the name of
Serverstat.
Since someone out there appears to want to know how to fix it and because I've found a work around, I figured I'd share the information. This fix has worked on our site monitoring the Ventrilo server since the beginning.
The full error is as follows: "Warning: Division by zero in /path/to/joomla/modules/mod_serverstat.php on line 172".
The division error was being caused by the modulus operator on line 72 which looks like this:
if ($row->tcounter > $serverstat_threshold && ($row->views % $serverstat_threshold !=0) && $serverstat_threshold !=0) {
We can fix this by either A):
changing line 172 to read
if ($row->tcounter > $serverstat_threshold && $serverstat_threshold !=0) {
which eliminates some of the error checking in case the server's status is unknown (i.e. not definitively up or down)
or B) adding a row to the table jos_serverstat_servers a.k.a. #_serverstat_servers.
Note: I suppose you could also just add the '@' symbol to the comparison as well to suppress the error but that's up to you.