aboutsummaryrefslogtreecommitdiffstats
path: root/admin/stats.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-08-02 22:04:30 +0000
committerz0rglub <z0rglub@piwigo.org>2003-08-02 22:04:30 +0000
commit2f0149d469120c50763ba76ec2db880962fccf42 (patch)
treecc1750d1302ab6f566fc2a754698355db2e654df /admin/stats.php
parent6132e0daa602ba94479d670217b25b92269b463f (diff)
Correcting possible division by 0
git-svn-id: http://piwigo.org/svn/trunk@52 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/stats.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/admin/stats.php b/admin/stats.php
index 61cecaa17..6e2b47cc2 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -151,7 +151,9 @@ for ( $i = 0; $i <= MAX_DAYS; $i++ )
//------------------------------------------------------------ pages seen graph
foreach ( $days as $day ) {
$vtp->addSession( $sub, 'pages_day' );
- $width = floor( ( $day['nb_pages_seen'] * $max_pixels ) / $max_pages_seen );
+ if ( $max_pages_seen > 0 )
+ $width = floor( ( $day['nb_pages_seen']*$max_pixels ) / $max_pages_seen );
+ else $width = 0;
$vtp->setVar( $sub, 'pages_day.date', $day['date'] );
$vtp->setVar( $sub, 'pages_day.width', $width );
$vtp->setVar( $sub, 'pages_day.nb_pages', $day['nb_pages_seen'] );
@@ -160,7 +162,9 @@ foreach ( $days as $day ) {
//-------------------------------------------------------------- visitors grpah
foreach ( $days as $day ) {
$vtp->addSession( $sub, 'visitors_day' );
- $width = floor( ( $day['nb_visitors'] * $max_pixels ) / $max_nb_visitors );
+ if ( $max_nb_visitors > 0 )
+ $width = floor( ( $day['nb_visitors'] * $max_pixels ) / $max_nb_visitors );
+ else $width = 0;
$vtp->setVar( $sub, 'visitors_day.date', $day['date'] );
$vtp->setVar( $sub, 'visitors_day.width', $width );
$vtp->setVar( $sub, 'visitors_day.nb_visitors', $day['nb_visitors'] );