| 75 | | // Convert uri 'label' to corresponding integer if needed |
| 76 | | if (is_string($this->uri_segment)) |
| 77 | | { |
| 78 | | if (($key = array_search($this->uri_segment, $this->url)) === FALSE) |
| 79 | | { |
| 80 | | // If uri 'label' is not found, auto add it to base_url |
| 81 | | $this->url[] = $this->uri_segment; |
| 82 | | $this->uri_segment = count($this->url) + 1; |
| 83 | | } |
| 84 | | else |
| 85 | | { |
| 86 | | $this->uri_segment = $key + 2; |
| 87 | | } |
| | 79 | // Insert {page} placeholder |
| | 80 | $_GET[$this->query_string] = '{page}'; |
| | 81 | |
| | 82 | // Create full URL |
| | 83 | $this->url = url::site(Router::$current_uri).'?'.str_replace('%7Bpage%7D', '{page}', http_build_query($_GET)); |
| 90 | | // Create a generic URL with query string and {page} number placeholder |
| 91 | | $this->url[$this->uri_segment - 1] = '{page}'; |
| 92 | | $this->url = url::site(implode('/', $this->url)).Router::$query_string; |
| | 86 | // Build generic URL with page as URI segment |
| | 87 | else |
| | 88 | { |
| | 89 | // Use current URI if no base_url set |
| | 90 | $this->url = ($this->base_url == '') ? Router::$segments : explode('/', trim($this->base_url, '/')); |
| | 91 | |
| | 92 | // Convert uri 'label' to corresponding integer if needed |
| | 93 | if (is_string($this->uri_segment)) |
| | 94 | { |
| | 95 | if (($key = array_search($this->uri_segment, $this->url)) === FALSE) |
| | 96 | { |
| | 97 | // If uri 'label' is not found, auto add it to base_url |
| | 98 | $this->url[] = $this->uri_segment; |
| | 99 | $this->uri_segment = count($this->url) + 1; |
| | 100 | } |
| | 101 | else |
| | 102 | { |
| | 103 | $this->uri_segment = $key + 2; |
| | 104 | } |
| | 105 | } |
| | 106 | |
| | 107 | // Insert {page} placeholder |
| | 108 | $this->url[$this->uri_segment - 1] = '{page}'; |
| | 109 | |
| | 110 | // Create full URL |
| | 111 | $this->url = url::site(implode('/', $this->url)).Router::$query_string; |
| | 112 | |
| | 113 | // Unvalidated current page |
| | 114 | $this->current_page = URI::instance()->segment($this->uri_segment); |
| | 115 | } |