Change logic of input of pagination links