Introduce pagination and generalize ?q= filtering #2487

All our API is now paginated and respond to &page and &perPage
GET parameters. For now pagination is done in PHP right before
sending the response, so it is sub-optimal compared to a DB
only solution. However it is good a enough for now and it could
be improved transparently on a case-by-case basis according to
perceived performances.

On the client-side Restangular is aware of pagination and all
pagination related information are available in the collection
'metadata' property.

The maximum perPage is set to 1000 in order to be able to display
correctly GLASS questionnaire on /contribute/questionnaire, but
ideally the limit should be lowered and the page modified to better
manage the big ammount of data.

Also our API now always filter objects when ?q= is specified as GET
parameters. This usually filter on code and/or name, but can
be different for a few special objects (such as questionnaires)