Fixing pagination & search bug in main page