fix search "undefined" when empty input, enhance pagination.