by using 'LIMIT 10' for the spamlevels, we only got the first
10 spamlevels back from the database. This is only ok if there are
only <= 10 different spamlevels in the database, but not if there are
more, as then the bucket for spamlevel >= 10 missed entries.
The call site of this uses the combined spam count of this query
result for calculating the 'rest' (meaning the mails with spam level
0), but this is obviously wrong if not all spamlevels are counted so
simply return all available levels.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
my $sth = $rdb->{dbh}->prepare("SELECT spamlevel, COUNT(spamlevel) AS count FROM CStatistic " .
"WHERE virusinfo IS NULL and time >= ? AND time < ? AND ptime > 0 AND spamlevel > 0 " .
- "GROUP BY spamlevel ORDER BY spamlevel LIMIT 10");
+ "GROUP BY spamlevel ORDER BY spamlevel");
$sth->execute($from, $to);
my $res = $sth->fetchall_arrayref({});