Doing both in the single query will not yield any performance benefit. However, the pagination data can be captured in an elegant way using a nuget package EntityFrameworkPaginate. The way it works is you set up your dynamic filtering and sorting and you will get a Page object as result which will have the result along with the metadata. (CurrentPage, PageCount, PageSize, RecordCount and Results).
First you need to setup your filters. In your case you have one condition. In scenario where you have multiple where clause based on different conditions, you can add those filters to the Filters object.
var filters = new Filters<Onlines>();
filters.Add(true, x => x.Date >= startDate.Date
&& x.Date <= endDate.Date && x.User.Id == userId);
Next, you need to set up your order by. Again in your case there is just one, but Sorts class can handle dynamic sorting as well.
var sorts = new Sorts<Onlines>();
sorts.Add(true, x => x.Date, true);
Now to finally get your paginated data, you need to call the extension method paginate on your dbset.
Page<Onlines> paginatedData = context.Employees.Paginate(page, size, sorts, filters);
Voila, you will get the paginated data with all the required metadata. This provides a clean approach and is very helpful when you have dynamic filtering and sorting. You can check the detailed article here.