<mt:SetVarBlock name="title"><$mt:BlogName encode_html="1"$> - <mt:BlogParentWebsite><$mt:WebsiteName encode_html="1"$></mt:BlogParentWebsite></mt:SetVarBlock>

<$mt:Include module="Header" body_class="mt-main-index"$>

<mt:var name="currentp" value="0">
<mt:var name="limit" value="10">
<$mt:BlogEntryCount setvar="lastn"$>
<?php
    $page = $_REQUEST['p'];
    if (!isset($page)) {
        $page = 1; 
    }
?>

<mt:Entries lastn="$lastn">

<mt:setvarblock name="page"><mt:getvar name="__counter__" op="mod" value="$limit"></mt:setvarblock>
<mt:if name="page" eq="1">
<mt:setvar name="currentp" op="add" value="1">
<mt:if name="currentp" gt="1"><?php } ?></mt:if>
<?php if ($page == <$mt:var name="currentp"$>) { ?>
</mt:if>

    <$mt:Include module="Entry Summary"$>

<mt:if name="__last__"><?php } ?></mt:if>

</mt:Entries>


        <div id="pager">
            <div class="panel1">
				<?php
                $totalNum=<$mt:BlogEntryCount$>;
                $pageSize=10;
                $nCurPageIndex=1;
				if(isset($_GET['p']))
	{
		$nCurPageIndex=intval($_GET['p']);
		if($nCurPageIndex<=0)
			$nCurPageIndex=1;
	}
                $nPageCount=@(($totalNum%$pageSize)!=0)?((int)($totalNum/$pageSize)+1):((int)($totalNum/$pageSize));
                if ($totalNum>0)
                {
                    $begin = (($nCurPageIndex - 5) < 1) ? 1 : ($nCurPageIndex - 5);
                    $end = ($begin + 9 >= $nPageCount) ? ($nPageCount) : ($begin + 9);
                    if ($begin != 1)
                    {
                        $lbFirst="<a href=\"?p=1\" class=\"lb1\" onmouseover=\"this.className='lb2'\" onmouseout=\"this.className='lb1'\" title=\"首页\">1...</a>";
                        echo $lbFirst;
                        
                        $pageid=$nCurPageIndex - 10 >= 1 ? ($nCurPageIndex - 10) : 1;
                        $lbFirst10="<a href=\"?p=".$pageid."\" class=\"lb1\" onmouseover=\"this.className='lb2'\" onmouseout=\"this.className='lb1'\"
                          title=\"前10页\"><<</a>";
                        printf($lbFirst10);
                    }
            
                    for ($i = $begin; $i <= $end; $i++)
                    {
                        $str="";
                        if ($i == $nCurPageIndex)
                        {
                            $str="<a class=\"lb\" title=\"当前页\">".$i."</a>";
                        }
                        else
                        {
                            $str="<a href=\"?p=".$i."\" class=\"lb1\" onmouseover=\"this.className='lb2'\" onmouseout=\"this.className='lb1'\"
                          title=\"\">".$i."</a>";
                        }
                        echo $str;
                    }
                    if ($end != $nPageCount)
                    {
                        $pageid=($nCurPageIndex + 10) <= $nPageCount ? ($nCurPageIndex + 10) : ($nPageCount);
                        $lbNext10="<a href=\"?p=".$pageid."\" class=\"lb1\" onmouseover=\"this.className='lb2'\" onmouseout=\"this.className='lb1'\" 
                         title=\"后10页\">>></a>";
                        printf($lbNext10);
                        
                        $lbLast="<a href=\"?p=".$nPageCount."\" class=\"lb1\" onmouseover=\"this.className='lb2'\" onmouseout=\"this.className='lb1'\"
                          title=\"尾页\">...".$nPageCount."</a>";
                        printf($lbLast);
                    }
                }
                ?>                
            </div>
            <div class="clr"></div>
        </div>
<$mt:Include module="Footer"$>

