Due to the way the build_sql method is written in AR, EVERY sql statement on a page gets an offset and limit set when you use pagination and the $_REQUESTpage? variable is set.
I'm thinking that build sql should be as "dumb" as possible and not infer anything about it's task at hand. if it needs to inset an offset, seems like it should be passed in as a value rather than grabbed from the $_REQUEST global.
the build_sql method also references "find_all_with_pagination" which i don't see anywhere else. this would be the ideal place to set the limit and offset for the paginated object, not for every single object that is built on the page regardless of whether or not it was intended to be paginated.
[[[
# Only use request's page if you are calling from find_all_with_pagination() and if it is int
if(strval(intval($_REQUESTpage?)) == $_REQUESTpage?) {
$this->page = $_REQUESTpage?;
}
if($this->page <= 0) {
$this->page = 1;
}
# Set the LIMIT string segment for the SQL
if(is_null($offset)) {
$offset = ($this->page - 1) * $this->rows_per_page;
}
$sql .= "LIMIT {$this->rows_per_page} OFFSET {$offset}";
# $sql .= "LIMIT $offset, $this->rows_per_page";
]]]