28 list($from, $to) = $ranges;
30 if (!empty($pageRangeFormat)) {
31 switch ($pageRangeFormat) {
33 $resTo = self::renderMinimal($from, $to, 0);
36 if (strlen($to) > 2) {
37 $resTo = self::renderMinimal($from, $to, strlen($to) - 2);
43 $resTo = self::renderChicago($from, $to);
49 return "$from-$resTo";
61 private static function renderMinimal($from, $to, $limit = 1)
64 if (strlen($from) == strlen($to)) {
65 for ($i = strlen($to) - 1; $i >= $limit; --$i) {
68 $digitFrom = $from[$i];
69 if ($digitTo !== $digitFrom) {
70 $resTo = $digitTo.$resTo;
78 private static function renderChicago($from, $to)
80 if ($from > 100 && ($from % 100 > 0) && intval(($from / 100), 10) === intval(($to / 100), 10)) {
81 return "".($to % 100);
82 } elseif ($from >= 10000) {
83 return "".($to % 1000);