21 lines
521 B
PHP
21 lines
521 B
PHP
<?php
|
|
/**
|
|
* Gestion de la pagination de la recherche.
|
|
*
|
|
* @param unknown_type $StartRow
|
|
* @param unknown_type $NUM_ROWS
|
|
*/
|
|
function getCurrentPage($StartRow, $NUM_ROWS)
|
|
{
|
|
return ($StartRow / $NUM_ROWS + 1);
|
|
}
|
|
|
|
function getNbOfPage($nbOfHits, $NUM_ROWS, $MAX_ROWS)
|
|
{
|
|
//(min(intval(99 / 10), 200 / 10) = 9 donc 9 page de 10 resultats.
|
|
$page = min(intval($nbOfHits / $NUM_ROWS), $MAX_ROWS / $NUM_ROWS);
|
|
if (intval($nbOfHits / $NUM_ROWS) < $nbOfHits / $NUM_ROWS)
|
|
$page;
|
|
return ($page++);
|
|
}
|
|
?>
|