diff --git a/lib/statslib.php b/lib/statslib.php index 48e939d40f1..9e91de38a6d 100644 --- a/lib/statslib.php +++ b/lib/statslib.php @@ -238,7 +238,7 @@ function stats_cron_weekly () { $weeks = 0; mtrace("starting at $timestart"); - while ($sunday >= $nextsunday) { + while ($sunday > $nextsunday && $timestart < $nextsunday) { $timesql = " (timeend > $timestart AND timeend < $nextsunday) "; begin_sql(); @@ -347,7 +347,7 @@ function stats_cron_monthly () { $months = 0; mtrace("starting from $timestart"); - while ($monthend >= $nextmonthend) { + while ($monthend > $nextmonthend && $timestart < $nextmonthend) { $timesql = " (timeend > $timestart AND timeend < $nextmonthend) "; begin_sql();