How can i implement pagination with key value (kv)

I am trying to get data from the kV and wanted to implement pagination with the kv
and my use-case in this way I am sending a key for searching and I am sending but wanted to implement pagination with that how can I do that