Added min and max function

usefull for pagination