{{if $current_page == $num_pages}}

<ul id="ts_css_nav">
  {{foreach from=$nav_pages item=page_info name=row}}
    {{assign var=i value=$smarty.foreach.row.iteration}}
    {{if $i != $num_pages}}
  <li class="completed_page"><div>&raquo; {{$page_info.page_name}}</div></li>
    {{else}}
  <li class="css_nav_current_page"><div>&raquo; {{$page_info.page_name}}</div></li>
    {{/if}}
  {{/foreach}}
</ul>

{{else}}

<ul id="ts_css_nav">
  {{foreach from=$nav_pages item=page_info name=row}}
    {{assign var=i value=$smarty.foreach.row.iteration}}
    {{if $current_page > $i && $current_page != $num_pages}}
  <li class="completed_page"><a href="?page={{$i}}">&raquo; {{$page_info.page_name}}</a></li>
    {{elseif $current_page == $i || $current_page == $num_pages}}
  <li class="css_nav_current_page"><div>&raquo; {{$page_info.page_name}}</div></li>
    {{else}}
  <li><div>&raquo; {{$page_info.page_name}}</div></li>
    {{/if}}
  {{/foreach}}
</ul>

{{/if}}

