diff --git a/ippisite/ippidb/templates/compound_list.html b/ippisite/ippidb/templates/compound_list.html
index 42461ec98de2704f3442958d05bfb3082593d1ec..a189f2c6094c4e17293ec53fb3eb4f4ed5168895 100644
--- a/ippisite/ippidb/templates/compound_list.html
+++ b/ippisite/ippidb/templates/compound_list.html
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
-
+{% load customtags %}
     
 {% block title %}compound{% endblock %}
 
@@ -46,7 +46,7 @@
   <ul class="pagination justify-content-end">
     {% if compounds.has_previous %}
     <li class="page-item">
-     <a class="page-link" href="?page={{ compounds.previous_page_number }}" tabindex="-1">Previous</a>
+     <a class="page-link" href="?{% url_replace request 'page' compounds.previous_page_number  %}" tabindex="-1">Previous</a>
     </li>
     {% endif %}
 
@@ -56,7 +56,7 @@
 
     {% if compounds.has_next %}
     <li class="page-item">
-     <a class="page-link" href="?page={{ compounds.next_page_number }}" tabindex="-1">Next</a>
+     <a class="page-link" href="?{% url_replace request 'page' compounds.next_page_number  %}" tabindex="-1">Next</a>
     </li>
     {% endif %}
   </ul>
diff --git a/ippisite/ippidb/templatetags/__init__.py b/ippisite/ippidb/templatetags/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/ippisite/ippidb/templatetags/customtags.py b/ippisite/ippidb/templatetags/customtags.py
new file mode 100644
index 0000000000000000000000000000000000000000..c01874f816c8d9e59c10eb2558494886a46063c4
--- /dev/null
+++ b/ippisite/ippidb/templatetags/customtags.py
@@ -0,0 +1,9 @@
+from django import template
+
+register = template.Library()
+
+@register.simple_tag
+def url_replace(request, field, value):
+    dict_ = request.GET.copy()
+    dict_[field] = value
+    return dict_.urlencode()