My pagination is not working properly. The problem is when I'm clicking on 2nd page or any other page it does the right thing. But when I click on 1st page number or the page number on which I'm right now it redirects me to base_url like localhost/project/project. It should not happen it should go localhost/project/project/0 or localhost/project/project/1 or localhost/project/project/2 or that page number.
$page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;
$total_rows = $this->Product_model->fetch_data('','',$keyword);
//$offset = 0;
$config = array();
$config["base_url"] = base_url().'product';
$config["total_rows"] = $total_rows->num_rows();
$config["cur_page"] = $page;
$config["per_page"] = 1; //display atleast 6 per page
$config["num_link"] = 2;
$config["uri_segment"] = 4;
$config['first_url'] = base_url() . 'product/0';