modify prev and next links for correct working with filter