Add support for pagination and fix URL escaping bug