What is ? Do you know for what values of ? If you do, then split the integral into two integrals. For the values of where it is greater than or equal to , replace by . For the values where , replace by .
Edit: This is a guess. I have never studied calculus of variations.