Fixed #3833 Undefined variable: sql_limit_to_append.
Initialized the varible sql_limit_to_append,
Since isset($x) returns true when $x=''(which is not the expected behaviour of the usage), used the function empty()