diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 9e293e09799599f4989295d2e2c243430cb1aaf2..bda7dd7a594a657647227a2a81fe114828a6ae48 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -543,8 +543,10 @@ $resql=$db->query($sql);
 if ($resql)
 {
     $num = $db->num_rows($resql);
+
+    $MAXONSAMEPAGE=10000;   // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
     $i=0;
-    while ($i < $num)
+    while ($i < $num && $i < $MAXONSAMEPAGE)
     {
         $obj = $db->fetch_object($resql);