[% IF ( view.data.page.last_page || 0 ) > 1 %]

[% serialized_params = self.serialize_params( [ 'page' ] ); %]
[% serialized_params = serialized_params ? '&' _ serialized_params : '' %]

<p class="pager_next" style="float: right; padding-left: 10px">
    [% IF view.data.page.next_page %]
    <a href="[% site.uri %]?page=[% view.data.page.next_page %][%-
    serialized_params %]">
    Next >>
    </a>
    [% END %]
</p>

[% 
   fp = view.data.page.first_page + 0; 
   cp = view.data.page.current_page + 0;
   lp = view.data.page.last_page + 0;
      
   pages_in_set = self.fish_config( 'pages_in_set' ) || 10;
  
   last_page_diff  = lp - cp;
   first_page_diff = cp - fp;
   
   IF ( last_page_diff > pages_in_set );
      lp = cp + pages_in_set;
      lp_shortened = 1;
   END;

   IF ( first_page_diff > pages_in_set );
      fp = cp - pages_in_set;
      fp_shortened = 1;
   END;
   
%]

<p  class="pager_pages" style="float: right; padding-left: 10px">

[% IF fp_shortened %]
    <a style="padding-right: 10px;" href="[% site.uri %]?page=1[%-
    serialized_params %]">1</a>
[% END %]

[% FOREACH page = [ fp .. lp ] %]
    [% IF page == cp %]
        <span class="current_page">[% page %]</span>
    [% ELSE %]
        <a href="[% site.uri %]?page=[% page %][% serialized_params %]">
        [% page %]</a>
    [% END %]
[% END %]

[% IF lp_shortened %]
    <a style="padding-left: 10px;" href="[% site.uri %]?page=[%
    view.data.page.last_page %][% serialized_params %]">
        [% view.data.page.last_page %]
    </a>
[% END %]
</p>

<p class="pager_previous" style="float: right; padding-left: 10px">
    [% IF view.data.page.previous_page %]
    <a href="[% site.uri %]?page=[% view.data.page.previous_page %][%-
        serialized_params %]">
    << Previous
    </a>
    [% END %]
</p>

<br style="clear: both" />

[% END %]
