Nothing seems to happen when the encoder value = 50? Perhaps it doesn't matter?
There is a lot of repetition in the code. How about using arrays?
If the encoder always increments the tests can be greatly simplified. If it has already passed 25 there is no need to check for that again when it exceeds 50.
...R