diff --git a/mo/web/templates/org_generic_list.html b/mo/web/templates/org_generic_list.html
index 106a0342ffa17cb7e7822f0cafa0593cf62419a4..e6c2e900dbd7e7b2a8acc9f7a1781d54a6fe1a69 100644
--- a/mo/web/templates/org_generic_list.html
+++ b/mo/web/templates/org_generic_list.html
@@ -60,9 +60,8 @@
 			<input type="hidden" name="offset" value="{{filter.offset.data}}">
 			<input type="hidden" name="limit" value="{{filter.limit.data}}">
 		</div>
-		{% set max = filter.offset.data + filter.limit.data if filter.offset.data + filter.limit.data < count else count %}
 		{% if count > 0 %}
-			Zobrazuji záznamy <b>{{filter.offset.data + 1}}</b> až <b>{{ max }}</b> z <b>{{count}} nalezených účastníků</b>.
+			Zobrazuji záznamy <b>{{filter.get_min()}}</b> až <b>{{filter.get_max(count)}}</b> z <b>{{count}} nalezených účastníků</b>.
 		{% else %}
 			<b>Nebyly nalezeny žádné záznamy účastníků.</b>
 		{% endif %}
diff --git a/mo/web/templates/org_orgs.html b/mo/web/templates/org_orgs.html
index 6bbe924a00e17eb8e086485134f0652ccd93942e..5ee560b45412322f5fea132943a6ccf777209a5c 100644
--- a/mo/web/templates/org_orgs.html
+++ b/mo/web/templates/org_orgs.html
@@ -61,9 +61,8 @@
 				<button class="btn" disabled>Další</button>
 			{% endif %}
 	</div>
-	{% set max = filter.offset.data + filter.limit.data if filter.offset.data + filter.limit.data < count else count %}
 	{% if count > 0 %}
-		Zobrazuji záznamy <b>{{filter.offset.data + 1}}</b> až <b>{{ max }}</b> z <b>{{count}} nalezených organizátorů</b>.
+		Zobrazuji záznamy <b>{{filter.get_min()}}</b> až <b>{{filter.get_max(count)}}</b> z <b>{{count}} nalezených organizátorů</b>.
 	{% else %}
 		<b>Nebyly nalezeny žádné záznamy organizátorů.</b>
 	{% endif %}
diff --git a/mo/web/templates/org_users.html b/mo/web/templates/org_users.html
index 82aaf3a79e83758fc24f93ce5b17d8c505f8a286..198e5b6531df46faef0a16b5d55ea3f5b9746348 100644
--- a/mo/web/templates/org_users.html
+++ b/mo/web/templates/org_users.html
@@ -54,9 +54,8 @@
 				<button class="btn" disabled>Další</button>
 			{% endif %}
 	</div>
-	{% set max = filter.offset.data + filter.limit.data if filter.offset.data + filter.limit.data < count else count %}
 	{% if count > 0 %}
-		Zobrazuji záznamy <b>{{filter.offset.data + 1}}</b> až <b>{{ max }}</b> z <b>{{count}} nalezených soutěžících</b>.
+		Zobrazuji záznamy <b>{{filter.get_min()}}</b> až <b>{{filter.get_max(count)}}</b> z <b>{{count}} nalezených soutěžících</b>.
 	{% else %}
 		<b>Nebyly nalezeny žádné záznamy soutěžících.</b>
 	{% endif %}
diff --git a/mo/web/util.py b/mo/web/util.py
index 148665f1a9450989077def039a491e215c76e2ff..245438eb496320a6746353bb7d428665ee033bad 100644
--- a/mo/web/util.py
+++ b/mo/web/util.py
@@ -40,6 +40,20 @@ class PagerForm(FlaskForm):
 
         return (count, query)
 
+    def get_min(self) -> int:
+        if self.offset.data is not None:
+            return self.offset.data + 1
+        else:
+            return 0
+
+    def get_max(self, count) -> int:
+        if self.offset.data is None or self.limit.data is None:
+            return 0
+        if self.offset.data + self.limit.data < count:
+            return self.offset.data + self.limit.data
+        else:
+            return count
+
 
 def task_statement_exists(round: db.Round) -> bool:
     if round.tasks_file is None: