
{{!--

  This is a generic pagination template.

  It relies on the "pager" object to be privided, with following entries:

    * page_prev : number to address previous page, if 0 then previous page is disabled
    * page_next : page number to next opage, if 0 no more pages after current one
    * page      : number of current page, page counting starts with 1
    * filter    : an object that contains other GET parameters to be placed into the
                  pager's links; keys are the names of parameters and values are values
    * page_qnty : total number of pages available for current pager
    * count     : total number of pages items
    * pages     : simple array with item for each page, each item is corresponding page number

--}}

<ul class="pagination">
  <li {{# unless pager.page_prev }} class="disabled" {{/unless}}>
      <span>
        {{#if pager.page_prev}}
        <a href="?{{#each pager.filter }}{{@key}}={{this}}&{{/each}}page={{pager.page_prev}}">&laquo; Prev</a>
        {{else}}
        &laquo; Prev
        {{/if}}
      </span>
  </li>
  {{# each pager.pages }}

    {{# if_equal this ../pager.page }}
      <li>
        <span><a href="?{{#each ../pager.filter }}{{@key}}={{this}}&{{/each}}page={{this}}">{{ this }} of {{ ../pager.page_qnty }}</a></span>
      </li>
    {{/ if_equal}}

  {{/ each}}
  <li{{# unless pager.page_next }} class="disabled" {{/unless}}>
    <span>

        {{#if pager.page_next}}
        <a href="?{{#each pager.filter }}{{@key}}={{this}}&{{/each}}page={{pager.page_next}}">Next &raquo;</a>
        {{else}}
        Next &raquo;
        {{/if}}

    </span>
  </li>
</ul>
