@@ 28-33 (lines=6) @@ | ||
25 | if ($totalPages <= $numberOfResults) { |
|
26 | // all |
|
27 | $arrayData = $tempArrayRange; |
|
28 | } elseif ($selectedPage <= (round(($numberOfResults / 2), 0, PHP_ROUND_HALF_UP))) { |
|
29 | // 1-6+last |
|
30 | $arrayData = array_slice($tempArrayRange, 0, ($numberOfResults-1)); |
|
31 | $arrayData[] = $totalPages; |
|
32 | ||
33 | } elseif ($selectedPage >= $totalPages-round(($numberOfResults / 2), 0, PHP_ROUND_HALF_DOWN)) { |
|
34 | // first + $totalPages-5 - $totalPages |
|
35 | $arrayData = array_slice($tempArrayRange, $totalPages-($numberOfResults-1)); |
|
36 | $arrayData[] = 1; |
|
@@ 37-48 (lines=12) @@ | ||
34 | // first + $totalPages-5 - $totalPages |
|
35 | $arrayData = array_slice($tempArrayRange, $totalPages-($numberOfResults-1)); |
|
36 | $arrayData[] = 1; |
|
37 | } else { |
|
38 | // first + $totalPages-2 - $totalPages+2 + last |
|
39 | $arrayData = array_slice( |
|
40 | $tempArrayRange, |
|
41 | $selectedPage-(round(($numberOfResults / 2), 0, PHP_ROUND_HALF_DOWN)), |
|
42 | ($numberOfResults-2) |
|
43 | ); |
|
44 | ||
45 | $arrayData[] = 1; |
|
46 | $arrayData[] = $totalPages; |
|
47 | ||
48 | } |
|
49 | ||
50 | sort($arrayData); |
|
51 |