[eluser]Armchair Samurai[/eluser]
You need to make two queries - one to retrieve the total number of rows, and one to retrieve the records for the current page using limit and offset. For example, in your model, you'd have something like this:
Code:
function get_records($limit, $offset)
{
$data = new stdClass;
$data->total = $this->db->count_all('table');
$query = $this->db->get('table', $limit, $offset);
$data->records = $query->result();
return $data;
}