Exposing pagination fields in JSON responses

In order to build paginations easily.

Note: whenever we decide to release this, that will mean a lot of potentially breaking changes for people, so that this information gets exposed. That will also mean that we'll have to update all of our kits, like we've done with JS and Ruby before, and also all of our blog posts talking about PHP.

I'm feeling pretty safe about the code itself, but I could use a code review anyway, just to be sure.