Browse files

Handle cases where count returns 0 reports #581

  • Loading branch information...
1 parent 06add2c commit 6eeca154c92ea61418670b82a40729047e6d45b8 @rjmackay rjmackay committed Jun 14, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 application/helpers/reports.php
View
6 application/helpers/reports.php
@@ -900,12 +900,16 @@ public static function fetch_incidents($paginate = FALSE, $items_per_page = 0)
$page_limit = (intval($items_per_page) > 0)
? $items_per_page
: intval(Kohana::config('settings.items_per_page'));
+
+ $total_items = $incident_count->current()
+ ? $incident_count->current()->report_count
+ : 0;
self::$pagination = new Pagination(array(
'style' => 'front-end-reports',
'query_string' => 'page',
'items_per_page' => $page_limit,
- 'total_items' => $incident_count->current()->report_count
+ 'total_items' => $total_items
));
// Return paginated results

0 comments on commit 6eeca15

Please sign in to comment.