From 4b4dcf2e01d483bbfa4b0b00a600a50c0d65da0a Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 12 Jul 2017 23:05:26 +0200
Subject: [PATCH] Fix overload with a protection for rare case with very high
 nb of event

---
 htdocs/comm/action/index.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 9e293e09799..bda7dd7a594 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);
 
-- 
GitLab