{% if paginator.next_page or paginator.previous_page %}
  {% if paginator.previous_page %}
    <a href="{{ paginator.previous_page_path }}">Previous page</a>
  {% else %}
    Previous page
  {% endif %}
  |
  {% if paginator.next_page %}
    <a href="{{ paginator.next_page_path }}">Next page</a>
  {% else %}
    Next page
  {% endif %}
{% endif %}
