{% load i18n %}
<div class="paginator">
{% for letter in letters %}
{%  if current_letter == letter %}
 <span class="current-letter">
  <span class="current-page">{% if letter == "all" %}{% trans "All" %}{% else %}{{letter}}{% endif %}</span>
{%   if show_first %}
  <a href="?{{extra_query}}letter={{letter}}&page=1" title="{% trans "First Page" %}" rel="{{rel_first_page}}" >&laquo;</a>
{%   endif %}
{%   if has_previous %}
  <a href="?{{extra_query}}letter={{letter}}&page={{previous}}" title="{% trans "Previous Page" %}" rel="{{rel_prev_page}}">&lt;</a>
{%   endif %}
{%   for pagenum in page_numbers %}
{%    if pagenum == page and pages > 1 %}
  <span class="current-page">{{pagenum}}</span>
{%    elif pages > 1 %}
  <a href="?{{extra_query}}letter={{letter}}{% if pagenum != 1 %}&page={{pagenum}}{% endif %}" title="{% blocktrans %}Page {{pagenum}}{% endblocktrans %}"{% if rel_page %} rel="{{rel_page}}"{% endif %}>{{pagenum}}</a>
{%    endif %}
{%   endfor %}
{%   if has_next %}
  <a href="?{{extra_query}}letter={{letter}}&page={{next}}" title="{% trans "Next Page" %}" rel="{{rel_next_page}}">&gt;</a>
{%   endif %}
{%   if show_last %}
  <a href="?{{extra_query}}letter={{letter}}&page={{pages}}" title="{% trans "Last Page" %}" rel="{{rel_last_page}}">&raquo;</a>
{%   endif %}
{%   if pages > 1 %}
  <span class="page-count">{{pages}} pages&nbsp;</span>
{%   endif %}
 </span>
{%  else %}
 <a href="?{{extra_query}}letter={{letter}}" title="{{letter}}"{% if rel_page %} rel="{{rel_page}}"{% endif %}>{% if letter == "all" %}{% trans "All" %}{% else %}{{letter}}{% endif %}</a>
{%  endif %}
{% endfor %}
</div>
