<div class="pages">
Стр.:
{if $page == 1}
<span class="this_page">1</span>
{else}
<a href="{$link}page=1">1</a>
{/if}
{if $page>4}
..
{/if}
{section name=page loop=$k_page}
{if $smarty.section.page.iteration > 1 AND $smarty.section.page.iteration < $k_page  AND $smarty.section.page.iteration<=$page+3  AND $smarty.section.page.iteration>=$page-2}
{if $page == $smarty.section.page.iteration}
<span class="this_page">{$smarty.section.page.iteration}</span>
{else}
<a href="{$link}page={$smarty.section.page.iteration}">{$smarty.section.page.iteration}</a>
{/if}
{/if}
{/section}
{if $page < $k_page-4}
..
{/if}
{if $page == $k_page}
<span class="this_page">{$k_page}</span>
{else}
<a href="{$link}page={$k_page}">{$k_page}</a>
{/if}
</div>