Generic search and pagination - CodeIgniter