Simplify {min,max}_pages computation
Simplify legend computation