In postgres you have the OVER() window function you can use that will return the number of rows that would have been retrieved had there been no limit on the query, eg
SELECT id, COUNT(*) OVER() FROM sometable LIMIT 500;
this will return the number of rows found in each and every row, but you could filter the column out when displaying the data and just use it to display the message you mentioned.