Replace $pendingRequestCount with count()