{% macro pager(page) -%}
{% if page.total_pages > 1 %}
<div class="pager">
{% if page.page_num > 1 %}
  <a href="?page_num={{ page.page_num-1 }}">&larr;</a>
{% endif %}
{% for page_num in range(1, page.total_pages+1) %}
  {% if page_num == page.page_num %}
    {{ page_num }}
  {% else %}
    <a href="?page_num={{ page_num }}">{{ page_num }}</a>
  {% endif %}
{% endfor %}
{% if page.page_num < page.total_pages %}
  <a href="?page_num={{ page.page_num+1 }}">&rarr;</a>
{% endif %}
</div>
{% endif %}
{%- endmacro %}
