<?
function mess_str($pref,$max_mess_str,$page,$dop)
{
$mess = mysql_query("select * from `".$pref."` $dop");
$mess_col=mysql_num_rows($mess);
$str_col=ceil($mess_col/$max_mess_str);
for($i=1; $i<$str_col+1; $i++)
{
if(($page/$max_mess_str+1)==$i)
{
?>
<div class="pages">
<a class="pg sel" href="?page_<?=$pref?>=<?=($i-1)*$max_mess_str?>"><?=$i?></a>
<?}else{?>
<a class="pg" href="?page_<?=$pref?>=<?=($i-1)*$max_mess_str?>"><?=$i?></a>
<?
}
}
}
?>