Dimensional crossover in directed percolation