diff --git a/web/ajax/events.php b/web/ajax/events.php index 1f8e71f1a..833c566d5 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -223,9 +223,9 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim $data['rows'] = $rows; # totalNotFiltered must equal total, except when either search bar has been used - $data['totalNotFiltered'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total'); + $data['totalNotFiltered'] = dbFetchOne('SELECT count(*) AS Total FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total'); if ( $search != '' || count($advsearch) ) { - $data['total'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'.$where , 'Total', $wherevalues); + $data['total'] = dbFetchOne('SELECT count(*) AS Total FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'.$where , 'Total', $wherevalues); } else { $data['total'] = $data['totalNotFiltered']; }