aboutsummaryrefslogtreecommitdiffstats
path: root/admin/stats.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2007-01-18 09:05:39 +0000
committerplegall <plg@piwigo.org>2007-01-18 09:05:39 +0000
commit3f04afc12a369ca3284624de7b6695ab42cd0e4a (patch)
tree3fbe122d085948cc863855f88a4770a86f955cc7 /admin/stats.php
parentc2920c7738bfdb54d477dcdaf8213fbc47d3a783 (diff)
Bug fixed: infinite loop in history statistics summary when no data to
display. git-svn-id: http://piwigo.org/svn/trunk@1733 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/stats.php123
1 files changed, 63 insertions, 60 deletions
diff --git a/admin/stats.php b/admin/stats.php
index 1030c5f45..26ba459d6 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -437,75 +437,78 @@ foreach ($summary_lines as $line)
$datas[ $line[$key] ] = $line['nb_pages'];
}
-if (!isset($min_x) and !isset($max_x))
+if (!isset($min_x) and !isset($max_x) and count($datas) > 0)
{
$min_x = min(array_keys($datas));
$max_x = max(array_keys($datas));
}
-for ($i = $min_x; $i <= $max_x; $i++)
+if (count($datas) > 0)
{
- if (!isset($datas[$i]))
+ for ($i = $min_x; $i <= $max_x; $i++)
{
- $datas[$i] = 0;
- }
-
- $url = null;
-
- if (isset($page['day']))
- {
- $value = $i.' '.l10n('hour');
- }
- else if (isset($page['month']))
- {
- $url =
- PHPWG_ROOT_PATH.'admin.php'
- .'?page=stats'
- .'&amp;year='.$page['year']
- .'&amp;month='.$page['month']
- .'&amp;day='.$i
- ;
-
- $time = mktime(12, 0, 0, $page['month'], $i, $page['year']);
-
- $value = $i.' ('.$lang['day'][date('w', $time)].')';
- }
- else if (isset($page['year']))
- {
- $url =
- PHPWG_ROOT_PATH.'admin.php'
- .'?page=stats'
- .'&amp;year='.$page['year']
- .'&amp;month='.$i
- ;
-
- $value = $lang['month'][$i];
- }
- else
- {
- // at least the year is defined
- $url =
- PHPWG_ROOT_PATH.'admin.php'
- .'?page=stats'
- .'&amp;year='.$i
- ;
+ if (!isset($datas[$i]))
+ {
+ $datas[$i] = 0;
+ }
+
+ $url = null;
+
+ if (isset($page['day']))
+ {
+ $value = $i.' '.l10n('hour');
+ }
+ else if (isset($page['month']))
+ {
+ $url =
+ PHPWG_ROOT_PATH.'admin.php'
+ .'?page=stats'
+ .'&amp;year='.$page['year']
+ .'&amp;month='.$page['month']
+ .'&amp;day='.$i
+ ;
+
+ $time = mktime(12, 0, 0, $page['month'], $i, $page['year']);
+
+ $value = $i.' ('.$lang['day'][date('w', $time)].')';
+ }
+ else if (isset($page['year']))
+ {
+ $url =
+ PHPWG_ROOT_PATH.'admin.php'
+ .'?page=stats'
+ .'&amp;year='.$page['year']
+ .'&amp;month='.$i
+ ;
+
+ $value = $lang['month'][$i];
+ }
+ else
+ {
+ // at least the year is defined
+ $url =
+ PHPWG_ROOT_PATH.'admin.php'
+ .'?page=stats'
+ .'&amp;year='.$i
+ ;
+
+ $value = $i;
+ }
+
+ if ($datas[$i] != 0 and isset($url))
+ {
+ $value = '<a href="'.$url.'">'.$value.'</a>';
+ }
- $value = $i;
- }
-
- if ($datas[$i] != 0 and isset($url))
- {
- $value = '<a href="'.$url.'">'.$value.'</a>';
+ $template->assign_block_vars(
+ 'statrow',
+ array(
+ 'VALUE' => $value,
+ 'PAGES' => $datas[$i],
+ 'WIDTH' => ceil(($datas[$i] * $max_width) / $max_pages ),
+ )
+ );
}
-
- $template->assign_block_vars(
- 'statrow',
- array(
- 'VALUE' => $value,
- 'PAGES' => $datas[$i],
- 'WIDTH' => ceil(($datas[$i] * $max_width) / $max_pages ),
- )
- );
}
// +-----------------------------------------------------------------------+