Pagination in Codeigniter php

//Pagination urlĀ 
$paging_url = 'Your Page Url';

$show_per_page = 3;

$config = array();
$config["base_url"] = $paging_url;
$config["total_rows"] = $total_row;
$config["per_page"] = $show_per_page;
$config['use_page_numbers'] = TRUE;
$config['page_query_string'] = TRUE;
$config['enable_query_strings'] = TRUE;
$config['query_string_segment'] = 'page';
$config['num_links'] = $total_row;

$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';

$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';

$this->pagination->initialize($config);
if($this->input->get('per_page')){ 
    $page = $this->input->get('per_page');
}else{ 
   $page = 1;
}

$str_links = $this->pagination->create_links();
$links = explode('&nbsp;',$str_links );