diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 747e5154ce..852d00f270 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -6472,7 +6472,12 @@ function event_print_graph(
             $color[] = '#82b92f';
         }
     } else {
-        $interval_length = (int) ($period / $num_intervals);
+        $interval_length = 0;
+
+        if ($num_intervals > 0) {
+            $interval_length = (int) ($period / $num_intervals);
+        }
+
         $intervals = [];
         $intervals[0] = $start_utimestamp;
         for ($i = 0; $i < $num_intervals; $i++) {
diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php
index be5f6047e3..f47fc71f55 100644
--- a/pandora_console/operation/events/events.php
+++ b/pandora_console/operation/events/events.php
@@ -1234,7 +1234,7 @@ if (is_ajax() === true) {
 
             $data = array_values(
                 array_filter(
-                    $data,
+                    ($data ?? []),
                     function ($item) {
                         return (bool) (array) $item;
                     }