# HG changeset patch
# User Arthur Lutz <arthur.lutz@logilab.fr>
# Date 1484652365 -3600
#      Tue Jan 17 12:26:05 2017 +0100
# Node ID 5e539ec0c9b53cefd1dddb4a03fd1213d2392e95
# Parent  e6db12c7be3355f705dedfcc39329c1b85850200
[views] add max pagination (avoid elasticsearch crash) (closes #17049617)

diff --git a/views.py b/views.py
--- a/views.py
+++ b/views.py
@@ -215,7 +215,7 @@
                             href=xml_escape(self._cw.build_url(**url_params)))))
             else:
                 ul(t.li(t.a(self.previous_link)))
-            total_pages = (response.hits.total / 10) + 2
+            total_pages = min((response.hits.total / 10) + 2, 1000)
             page_padding = 3
 
             if current_page > page_padding: