How to check if the grid has filters through php

hello, is there a way to check when the grid loads if it has a filter set up through the search app? im using a huge table and if there are no filters it takes several minutes to load, i want to check if it has any filters and modify the sql top only bring the top 1000.

In SEARCH section in the onvalidate event set a global variable to TRUE. When loading the grid check the value of this global and adjust a LIMIT to your grid