function ShowNavigator($a, $offset, $q, $path, &$out) { //shows navigator [prev] 1 2 3 4 � [next] //$a - count of elements in the array, which is being navigated //$offset - current offset in array (showing elements [$offset ... $offset+$q]) //$q - quantity of items per page //$path - link to the page (f.e: "index.php?categoryID=1&") if ($a > $q) { //[prev] if ($offset > 0) { $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=" . ($offset - $q)) . "\"><< " . translate("str_previous") . "</a> "; } //digital links $k = $offset / $q; //not more than 4 links to the left $min = $k - 5; if ($min < 0) { $min = 0; } else { if ($min >= 1) { //link on the 1st page $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=0") . "\">1</a> "; if ($min != 1) { $out .= "... "; } } } for ($i = $min; $i < $k; $i++) { $m = $i * $q + $q; if ($m > $a) { $m = $a; } $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=" . $i * $q) . "\">" . ($i + 1) . "</a> "; } //# of current page if (strcmp($offset, "show_all")) { $min = $offset + $q; if ($min > $a) { $min = $a; } $out .= "<font class=faq><b>" . ($k + 1) . "</b></font> "; } else { $min = $q; if ($min > $a) { $min = $a; } $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=0") . "\">1</a> "; } //not more than 5 links to the right $min = $k + 6; if ($min > ceil($a / $q)) { $min = ceil($a / $q); } for ($i = $k + 1; $i < $min; $i++) { $m = $i * $q + $q; if ($m > $a) { $m = $a; } $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=" . $i * $q) . "\">" . ($i + 1) . "</a> "; } if ($min * $q < $a) { //the last link if ($min * $q < $a - $q) { $out .= " ... "; } if (!($a % $q == 0)) { $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=" . ($a - $a % $q)) . "\">" . (floor($a / $q) + 1) . "</a> "; } else { //$a is divided by $q $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=" . ($a - $q)) . "\">" . floor($a / $q) . "</a> "; } } //[next] if (strcmp($offset, "show_all")) { if ($offset < $a - $q) { $out .= "<a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=" . ($offset + $q)) . "\">" . translate("str_next") . " >></a> "; } } //[show all] if (SHOWALL_ALLOWED_RECORDS_NUM >= $a || !SystemSettings::is_hosted() && SystemSettings::is_backend()) { if (strcmp($offset, "show_all")) { $out .= " | <a class=no_underline href=\"" . xHtmlSetQuery($path . "&offset=&show_all=yes") . "\">" . translate("str_showall") . "</a>"; } else { $out .= " | <B>" . translate("str_showall") . "</B>"; } } } }