I found the problem with Monthly registrations stats.
The section in statistics.php that computes the year(s) is incorrect:
PHP Code:
// calc year to get registrations from
$year = $today['year'];
if ($howmany > $today['month']) {
$year--;
}
$year = $year - floor(($howmany - $today['month']) / 12);
// calc month since to get registrarions from
$month = $today['month'] - ($howmany - 1);
if ($month < 1) {
$month = 12 + ($month % 12);
}
The statement on line 1293 is incorrect.
PHP Code:
$year = $year - floor(($howmany - $today['month']) / 12);
As mentioned in other posts this just started happening. It's because the default results number is 10 & November is the 11th month. What happens is if the results # is lower then the current month the PHP function "floor" rounds down but it's rounding down a negative number and then when you subtract a negative # you are adding, so it's getting registration stats for the year 2008!
$year = $year - floor(($howmany - $today['month']) / 12)
$year = $year - floor((10 - 11) / 12)
$year = $year - floor((-1) / 12)
$year = $year - floor(-0.0833)
$year = $year - -1
$year = 2007 - -1
$year = 2008
A simple fix is to use the "intval" function rather then "floor", which just returns the integer which is what was being attempted with the "floor" function and when the result is (-0.0833) it will return 0 which will work.
PHP Code:
// calc year to get registrations from
$year = $today['year'];
if ($howmany > $today['month']) {
$year--;
}
$year = $year - intval(($howmany - $today['month']) / 12);
// calc month since to get registrarions from
$month = $today['month'] - ($howmany - 1);
if ($month < 1) {
$month = 12 + ($month % 12);
}