codeigniter分页中的索引限制

Sorry, i want the create table pagination to join two tables i've try to created it and when i click 'next' there's error like this.

Error Index Limit

My Code in controller

public function index()
{
    $this->load->model('mymodel');
    $this->load->library('pagination');
    $config['base_url'] = base_url().'index.php/admin/page/index/';
    $config['total_rows'] = $this->mymodel->tampil_data()->num_rows();
    $config['per_page'] = 10; 
    $this->pagination->initialize($config); 
    $data['paging']     =$this->pagination->create_links();
    $halaman            =  $this->uri->segment(3);
    $halaman            =$halaman==''?0:$halaman;
    $data['record']     =    $this->mymodel->tampil_data_paging($halaman,$config['per_page']);
    $this->template->load('template','view',$data);
}

and mymodel

    function tampil_data()
    {
        $query= "SELECT b.requestorname,b.checkin,b.checkout,b.company,b.email,b.contactnumber,b.purpose,
        kb.name,kb.checkinvisitor,kb.checkoutvisitor,kb.companyvisitor,kb.position,kb.contactnumbervisitor
                FROM messrequestor as b,messvisitor as kb
                WHERE b.idrequestor=kb.idrequestor";
        return $this->db->query($query);
    }

        function tampil_data_paging($halaman,$batas)
    {
        $query= "SELECT b.requestorname,b.checkin,b.checkout,b.company,b.email,b.contactnumber,b.purpose,
        kb.name,kb.checkinvisitor,kb.checkoutvisitor,kb.companyvisitor,kb.position,kb.contactnumbervisitor
                FROM messrequestor as b,messvisitor as kb
                WHERE b.idrequestor=kb.idrequestor limit $halaman,$batas";
        return $this->db->query($query);
    }

how to solve it?

Thank You

public function index()
{
    $this->load->model('mymodel');
    $this->load->library('pagination');
    $config['base_url'] = base_url().'index.php/admin/page/index/';
    $config['total_rows'] = $this->mymodel->tampil_data()->num_rows();
    $config['per_page'] = 10; 
    $this->pagination->initialize($config); 
    $data['paging']     =$this->pagination->create_links();
    $halaman            =  $this->uri->segment(3);
    $halaman            =$halaman==''?0:$halaman;
    $data['record']     =    $this->mymodel->tampil_data_paging($halaman,$config['per_page']);
    $this->template->load('template','view',$data);
}

in this controller you retrieving the segment as 'index' so this is being placed in your sql, you need to get other segment

$config['base_url'] = base_url().'index.php/admin/page/index/';
//then you use this
$halaman =  $this->uri->segment(3);
$halaman =$halaman==''?0:$halaman;

This is retrieving the segment as 'index' so this is being placed in your sql and that's where the error is. If the actual value is after then you need to get the other segment i.e 4

$query= "SELECT b.requestorname,b.checkin,b.checkout,b.company,b.email,b.contactnumber,b.purpose,
    kb.name,kb.checkinvisitor,kb.checkoutvisitor,kb.companyvisitor,kb.position,kb.contactnumbervisitor
            FROM messrequestor as b,messvisitor as kb
            WHERE b.idrequestor=kb.idrequestor limit $halaman,$batas