private function generateUrl($page_value, $direction = '', $return_value_only = false)
    {
        switch ($direction) {
            case 'first':
                if ($this->page_number_type == 'start_num') {
                    $page_value = 0;
                } elseif ($this->page_number_type == 'page_num') {
                    $page_value = 1;
                }
                break;
            case 'previous':
                if ($this->page_number_type == 'start_num') {
                    $page_value = ($page_value - $this->items_per_page);
                    if ($page_value < 0) {
                        $page_value = 0;
                    }
                } elseif ($this->page_number_type == 'page_num') {
                    $page_value = ($page_value - 1);
                    if ($page_value <= 0) {
                        $page_value = 1;
                    }
                }
                break;
            case 'next':
                if ($this->page_number_type == 'start_num') {
                    $page_value = ($page_value + $this->items_per_page);
                    if ($page_value > (($this->total_pages*$this->items_per_page) - $this->items_per_page)) {
                        $page_value = (($this->total_pages*$this->items_per_page) - $this->items_per_page);
                    }
                } elseif ($this->page_number_type == 'page_num') {
                    $page_value = ($page_value + 1);
                    if ($page_value > (($this->total_pages*$this->items_per_page) / $this->items_per_page)) {
                        $page_value = (($this->total_pages*$this->items_per_page) / $this->items_per_page);
                    }
                }
                break;
            case 'last':
                if ($this->page_number_type == 'start_num') {
                    $page_value = ($page_value - $this->items_per_page);
                } elseif ($this->page_number_type == 'page_num') {
                    $page_value = ($page_value / $this->items_per_page);
                }
                break;
            default:
                // calculate page querystring number from generated before and after current pages. example 1 2 [3] 4 5 current is 3, generated is 1 2 and 4 5
                if ($this->page_number_type == 'start_num') {
                    $page_value = (($page_value * $this->items_per_page) - $this->items_per_page);
                }
                break;
        }

        if ($return_value_only === true) {
            return $page_value;
        } else {
            return str_replace('%PAGENUMBER%', $page_value, $this->base_url);
        }
    }