Same points, but we're second to Legia Warsaw? We have a better goal difference (+ 3 to their +1)? Different rulings or what?
Is it done on head to head result between the 2 teams on equal points?
Yes...
This is how teams which are on the same points are ranked:
Points in head-to-head matches among the tied teams;
Goal difference in head-to-head matches among the tied teams;
Goals scored in head-to-head matches among the tied teams;
If more than two teams are tied, and after applying all head-to-head criteria above, a subset of teams are still tied, all head-to-head criteria above are reapplied exclusively to this subset of teams;
Goal difference in all group matches;
Goals scored in all group matches;
Away goals scored in all group matches;
Wins in all group matches;
Away wins in all group matches;
Disciplinary points (direct red card = 3 points; double yellow card = 3 points; single yellow card = 1 point);
UEFA club coefficient.