<div id="page">
<?php 
$p_head = "|&lt;&lt;先頭ページへ";
$p_prev = "&lt;前へ";
$p_next = "次へ&gt;";
$p_tail = "末尾ページへ&gt;&gt;|";

$wsiz = 10;
$w1 = 5;
$w2 = 5;

$pcnt = ceil($found / $rows);
$cpag = $start / $rows + 1;
$wbgn = $cpag - $w1;
$wend = $cpag + $w2;
if( $wbgn < 1 ){
  $wbgn = 1;
  $wend = $wbgn + $wsiz;
  if( $wend > $pcnt + 1 ){
    $wend = $pcnt + 1;
  }
}
if( $wend > $pcnt + 1 ){
  $wend = $pcnt + 1;
  $wbgn = $wend - $wsiz;
  if( $wbgn < 1 ){
    $wbgn = 1;
  }
}
?>
<?php if( $pcnt > 1 ){ ?>
<strong>Page</strong>
  <?php if( $cpag > 1 ){ ?>
    <a href="./index.php?<?php echo $handler->getLinkStr("" , 0) ?>"><?php echo $p_head ?></a>&nbsp;&nbsp;&nbsp;
    <a href="./index.php?<?php echo $handler->getLinkStr("", (($cpag-2)*$rows)) ?>"><?php echo $p_prev ?></a>&nbsp;&nbsp;&nbsp;
  <?php } ?>
  &nbsp;
  <?php for($i=$wbgn;$i<$wend;$i++){ ?>
    <?php if($cpag == $i){ ?>
      <?php echo $i ?>&nbsp;&nbsp;&nbsp;
    <?php }else{ ?>
      <a href="./index.php?<?php echo $handler->getLinkStr("", (($i-1)*$rows)) ?>"><?php echo $i ?></a>&nbsp;&nbsp;&nbsp;
    <?php } ?>
  <?php } ?>
  &nbsp;
  <?php if( $cpag < $pcnt ){ ?>
    <a href="./index.php?<?php echo $handler->getLinkStr("", ($cpag*$rows)) ?>"><?php echo $p_next ?></a>&nbsp;&nbsp;&nbsp;
    <a href="./index.php?<?php echo $handler->getLinkStr("", (($pcnt-1)*$rows)) ?>"><?php echo $p_tail ?></a>&nbsp;&nbsp;&nbsp;
  <?php } ?>
<?php } ?>
</div>
