Fix improper key encoding in pagination

Keys must be properly JSON encoded (see http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writing-querying-selection.html).