Existence and regularity in the small in the calculus of variations