get the code closer to the orm bundle's code

It is the model we are following
compute the last page after the number of results

The last page can't be computed safely without it.