dynamic_siblings)): $current_page = $position; $i = 1; $total_pages = count($theme->dynamic_siblings); foreach ($theme->dynamic_siblings as $one_sibling): if ($page_type == "item"): $_pagelist[$i] = url::site("tag_albums/show/" . $one_sibling->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($one_sibling->name)); endif; $i++; endforeach; else: switch ($page_type): case "collection": if (isset($item)): $parent = $item->parent(); endif; $current_page = $page; $total_pages = $max_pages; // Prepare page url list for ($i = 1; $i <= $total_pages; $i++): $_pagelist[$i] = url::site(url::merge(array("page" => $i))); endfor; break; case "item": if (isset($first_page_url)): // Good item collection if (isset($item)): $parent = $item->parent(); endif; if (isset($position)): $current_page = $position; else: $current_page = 1; endif; $total_pages = $total; if (isset($parent)): $siblings = $parent->children(); for ($i = 1; $i <= $total; $i++): $sibling = $siblings[$i-1]; if (method_exists($sibling, 'url')): $_pagelist[$i] = $sibling->url(); endif; endfor; endif; else: // "Bad" item collection - photo from tag based collection $total_pages = 1; $current_page = 1; endif; break; default: $current_page = 1; $total_pages = 1; $_pagelist[1] = url::site(); break; endswitch; endif; if ($total_pages <= 1): $pagination_msg = " "; else: $pagination_msg = t("Page:") . ' '; if ($total_pages < 13): for ($i = 1; $i <= $total_pages; $i++): if ($i == $current_page): $pagination_msg .= '' . t($i) . ''; else: $pagination_msg .= '' . t($i) . ''; endif; if ($i < $total_pages): $pagination_msg .= '·'; endif; endfor; elseif ($current_page < 9): for ($i = 1; $i <= 10; $i++): if ($i == $current_page): $pagination_msg .= '' . t($i) . ''; else: $pagination_msg .= '' . t($i) . ''; endif; if ($i < 10): $pagination_msg .= '·'; endif; endfor; $pagination_msg .= '…'; $pagination_msg .= '' . t($total_pages - 1) . ''; $pagination_msg .= '·'; $pagination_msg .= '' . t($total_pages) . ''; elseif ($current_page > $total_pages - 8): $pagination_msg .= '' . t(1) . ''; $pagination_msg .= '·'; $pagination_msg .= '' . t(2) . ''; $pagination_msg .= '…'; for ($i = $total_pages - 9; $i <= $total_pages; $i++): if ($i == $current_page): $pagination_msg .= '' . t($i) . ''; else: $pagination_msg .= '' . t($i) . ''; endif; if ($i < $total_pages): $pagination_msg .= '·'; endif; endfor; else: $pagination_msg .= '' . t(1) . ''; $pagination_msg .= '·'; $pagination_msg .= '' . t(2) . ''; $pagination_msg .= '…'; for ($i = $current_page - 5; $i <= $current_page + 5; $i++): if ($i == $current_page): $pagination_msg .= '' . t($i) . ''; else: $pagination_msg .= '' . t($i) . ''; endif; if ($i < $current_page + 5): $pagination_msg .= '·'; endif; endfor; $pagination_msg .= '…'; $pagination_msg .= '' . t($total_pages - 1) . ''; $pagination_msg .= '·'; $pagination_msg .= '' . t($total_pages) . ''; endif; endif; ?>