Fix total record count

Before, the total record count and the matching search record count
would wrongly return the same number.

Now, the total record count is correct again.

This was done by FIRST getting and saving the total record count,
and only then allowing more conditions to be added on the query.

Since the total record count must be gotten first, I've put it right
in the Datatable initialize method, before anything else happens.

It's not good to have logic like this is an initializer, so If you
can find a better way to do this and avoid the logic in the
initializer, please do!