select ceil(count(*) / [pagination::get_rows_per_page] ) from ($sql) x