Guarding divisions
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 15 Nov 2003 11:07:49 +0000 (11:07 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 15 Nov 2003 11:07:49 +0000 (11:07 +0000)
includes/SpecialStatistics.php

index 35c4f21..b353ecf 100644 (file)
@@ -24,8 +24,8 @@ function wfSpecialStatistics()
        $text = str_replace( "$2", $good, $text );
        $text = str_replace( "$3", $views, $text );
        $text = str_replace( "$4", $edits, $text );
-       $text = str_replace( "$5", sprintf( "%.2f", $edits / $total ), $text );
-       $text = str_replace( "$6", sprintf( "%.2f", $views / $edits ), $text );
+       $text = str_replace( "$5", sprintf( "%.2f", $total ? $edits / $total : 0 ), $text );
+       $text = str_replace( "$6", sprintf( "%.2f", $edits ? $views / $edits : 0 ), $text );
 
        $wgOut->addHTML( $text );
        $wgOut->addHTML( "<h2>" . wfMsg( "userstats" ) . "</h2>\n" );