Added sorting and limit to active pages