[eluser]Harold Villacorte[/eluser]
You have a pretty good idea of what is going on. You were very close but you were doing certain things in an odd sort of way. Since you say you got it working I am assuming you understand most of it. I will just explain a few highlights.
You were already trying to do something similar. Here we are taking the page number generated by the pagination class and using it as the offset for the database query. That is it's main purpose. If the page is blank than the offset is 0. We also set this value as a variable so we can reuse it.:
Code:
$offset = ($page) ? $page : 0 ;
Remember that $offset is either 0 or the page number. We have to add 1 either way because the index start at zero, remember?
Code:
$first_record = $offset + 1;
You already had the result from the database query to generate the content so all we are doing is using PHP's built in count() function to count the result. You could have done this in the model with num_rows() but this way is fine. So we calculated the first record to either be 0 + 1 for the first page or $page +1 for subsequent pages, so now we just add the count() of the query to get the last record number. That's it. No complicated math, just find the simplest way of doing something.
Code:
$last_record = $page + count($statuses);
You were already getting the total count as a separate query which is correct. Here we just assigned it to a variable that we could reuse.
Code:
$total_count = $this->status_model->count_active_entries();