Correctly handle switching pages on search clicks.