Issue #139: Fix count and pagination.

This piece of code removes duplicated ids from a coma encoded list and rencodes it back. This may help to avoid useless processing improving performance a bit and remove duplicate listings.

`1,1,2,3,4,2,3,4,5` :arrow_right: `1,2,3,4,5`.