summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/statistics_reporting')
-rw-r--r--modules-available/statistics_reporting/inc/getdata.inc.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules-available/statistics_reporting/inc/getdata.inc.php b/modules-available/statistics_reporting/inc/getdata.inc.php
index f65ee868..a167c2e5 100644
--- a/modules-available/statistics_reporting/inc/getdata.inc.php
+++ b/modules-available/statistics_reporting/inc/getdata.inc.php
@@ -40,6 +40,7 @@ class GetData
$res = Queries::getLocationStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$data = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ self::nullToZero($row);
$median = self::calcMedian(self::calcMedian($row['medianSessionLength']));
$entry = array(
'location' => ($anonymize ? $row['locHash'] : $row['locName']),
@@ -69,6 +70,7 @@ class GetData
$res = Queries::getClientStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$data = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ self::nullToZero($row);
$median = self::calcMedian(self::calcMedian($row['medianSessionLength']));
$entry = array(
'hostname' => ($anonymize ? $row['clientHash'] : $row['clientName']),
@@ -116,12 +118,20 @@ class GetData
$data = array();
$vm = $anonymize ? 'vmHash' : 'name';
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ self::nullToZero($row);
$data[] = array('vm' => $row[$vm], 'sessions' => $row['count']);
}
return $data;
}
-
+ private function nullToZero(&$row)
+ {
+ foreach ($row as &$field) {
+ if (is_null($field)) {
+ $field = 0;
+ }
+ }
+ }
// Format $seconds into ".d .h .m .s" format (day, hour, minute, second)
private static function formatSeconds($seconds)